/*
 * @Author: xiaoyangzhao
 * @Date:   2018-08-01 18:45:30
 * @Last Modified by:   xiaoyangzhao
 * @Last Modified time: 2019-03-11 14:29:49
 */

import Vue from 'vue'
import Router from 'vue-router'

/* Layout */
import Layout from '../views/layout/Layout'

Vue.use(Router)

/**
* hidden: true                   if `hidden:true` will not show in the sidebar(default is false)
* alwaysShow: true               if set true, will always show the root menu, whatever its child routes length
*                                if not set alwaysShow, only more than one route under the children
*                                it will becomes nested mode, otherwise not show the root menu
* redirect: noredirect           if `redirect:noredirect` will no redirct in the breadcrumb
* name:'router-name'             the name is used by <keep-alive> (must set!!!)
* meta : {
    title: 'title'               the name show in submenu and breadcrumb (recommend set)
    icon: 'svg-name'             the icon show in the sidebar,
  }
**/

/**
 * 【roles权限映射】
 * 机构管理员 org_manager
 * 案件管理员 case_manager
 * 催收员 collector
 * 分单员 dispatcher
 * 上传员 uploader
 */
export const reportViewRouterMap = [{
  path: '',
  component: Layout,
  redirect: '/',
  name: 'Home',
  meta: {
    title: 'test1',
    icon: 'home'
  },
  children: [{
    path: 'statReport/reportView',
    component: () =>
				import('@/views/index/index'),
    meta: {
      title: '查看所有报表',
      icon: 'home',
      roles: ['org_manager', 'case_manager', 'collector', 'dispatcher', 'sky_advanced_dispatcher', 'uploader', 'phone_detect']
    }
  }]
}, {
  path: '/statReport',
  component: Layout,
  redirect: '/statReport/reportManage',
  name: 'StatisticalReport',
  meta: {
    title: '按报表周期查看',
    icon: 'statReport'
  },
  children: [/* {
			path: 'reportManage',
			name: 'ReportManage',
			component: () =>
				import('@/views/statReport/reportManage'),
			meta: {
				title: '查看实时报表',
				icon: 'reportManage',
				roles: ['org_manager', 'case_manager', 'collector']
				// roles: ['reporter']
			}
		}, */{
      path: 'reportView',
      name: 'ReportViewDay',
      component: () =>
				import('@/views/statReport/reportView'),
      meta: {
        title: '查看日报表',
        icon: 'statReport-day',
        roles: ['org_manager', 'case_manager', 'collector']
        // roles: ['reporter']
      }
    }, {
      path: 'reportView',
      name: 'ReportViewWeek',
      isDisabled: false,
      component: () =>
				import('@/views/statReport/reportView'),
      meta: {
        title: '查看周报表',
        icon: 'statReport-week',
        roles: ['org_manager', 'case_manager', 'collector']
        // roles: ['reporter']
      }
    }]
}, {
  path: '/statReport',
  component: Layout,
  // redirect: '/statReport/stat_case',
  redirect: '/statReport/reportView',
  name: 'StatisticalReport2',
  meta: {
    title: '按报表名称查看',
    icon: 'statReport'
  },
  children: [{
    path: 'reportView',
    name: 'StatCaseCover',
    component: () =>
				// import('@/views/statReport/stat_case'),
				import('@/views/statReport/reportView'),
    meta: {
      title: '案件覆盖率情况统计表',
      icon: 'statCase',
      roles: ['org_manager', 'case_manager', 'collector']
      // roles: ['reporter']
    }
  }, {
    path: 'reportView',
    // path: 'hour',
    name: 'ReportAvgEfficient',
    isDisabled: false,
    component: () =>
				import('@/views/statReport/reportView'),
    // import('@/views/statReport/hour'),
    meta: {
      title: '案件平均处理时效统计表',
      icon: 'reportView',
      roles: ['org_manager', 'case_manager', 'collector']
      // roles: ['reporter']
    }
  }, {
    path: 'reportView',
    // path: 'week_hour',
    name: 'ReportAvgEfficientTeamWeek',
    isDisabled: false,
    component: () =>
				import('@/views/statReport/reportView'),
    // import('@/views/statReport/week_hour'),
    meta: {
      title: '周案件处理时效统计表',
      icon: 'reportView',
      roles: ['org_manager', 'case_manager', 'collector', 'sky_report_view']
      // roles: ['reporter']
    }
  }, {
    path: 'reportView',
    // path: 'last_week_hour',
    name: 'ReportAvgEfficientTeamWeekDuring',
    isDisabled: false,
    component: () =>
				import('@/views/statReport/reportView'),
    // import('@/views/statReport/last_week_hour'),
    meta: {
      title: '周案件处理时效环比统计表',
      icon: 'reportView',
      roles: ['org_manager', 'case_manager', 'collector', 'sky_report_view']
    }
  }, {
    path: 'reportView',
    name: 'CasePayBackReport',
    component: () =>
				import('@/views/statReport/reportView'),
    meta: {
      title: '案件回款情况统计表',
      icon: 'casePayBackReport',
      roles: ['org_manager', 'case_manager', 'collector']
    }
  }/* , {
			path: 'reportView',
			name: 'CaseCallReport',
			component: () =>
				import('@/views/statReport/reportView'),
			meta: {
				title: '通话详情统计表',
                icon: 'caseCallReport',
				roles: ['org_manager', 'case_manager', 'collector']
			}
		} */]
},
{
  path: '*',
  redirect: '/404',
  // redirect: '/statReport/stat_case',
  hidden: true
}
]

export default new Router({
  // mode: 'history', //后端支持可开
  /* scrollBehavior: () => ({
	    y: 0
	}), */
  reportViews: reportViewRouterMap
})
